const fs = require('fs')
const path = require('path')

// 解析 txt 文件，将每一行视为一个班级名称，以数组形式返回至客户端
const getClassList = async (ctx, netx) => {
    const filePath = path.join(process.cwd(), 'db/classList.txt')
    const classList = fs.readFileSync(filePath, 'utf-8').split('\n')
    ctx.body = {
        code: 200,
        data: classList
    }
}


// 导出
module.exports = {
    getClassList
}